/**
 * cookie储存创建
 * @author Thousand-paper-crane
 * @param {String} key 
 * @param {Object} val 
 * @param {Number} s 
 * @return undefined
 */
function setTime(key,val,s){
    let d =new Date
    d.setTime(d.getTime()-1000*60*60*8+1000*s)
    document.cookie=`${key}=${val};expires=${d}`
}



/**
 * cookie储存获取
 * @author Thousand-paper-crane
 * @param {String} key 
 * @return String 储存的值
 */
function getTime(key){
    let str=document.cookie
    let arr=str.split(';')
    for(let i=0; i<arr.length; i++){
        let item=arr[i]
        let temparr=item.split('=')
        if(temparr[0]==key) return temparr[1]
    }
}



/**
 * cookie储存移除
 * @author Thousand-paper-crane
 * @param {String} key 
 * @return undefined
 */
function remove(key){
    setTime(key,null,-1)
}